/*
 * Copyright (C) 2009 CodeWerkz
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

// ========================================================================
// Set up packages and imports.
// ========================================================================
package com.codewerkz.prompty;

import android.app.Activity;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.codewerkz.util.SettingsLoader.LoadSettings;

/**
 * Class for showing 'About' information. 
 * @author ChaZ
 */ 
public class About extends Activity implements OnClickListener, LoadSettings {

	// Globals.
	//private static final String TAG = "Prompty - About";
	
	private Button mBackButton;
	
	/**
	 * Runs this function when the Activity is started.
	 * 
	 * @return void
	 */
	@Override
    protected void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
    	
    	// Load the view
    	this.setContentView(R.layout.about);
    	
    	// Get the button & Set up onClick listeners. 
    	this.mBackButton = (Button) this.findViewById(R.id.about_backButton);
    	this.mBackButton.setOnClickListener(this);
    	
    	// Load the settings.
    	this.loadSettings();
    }
	
	/**
	 * Loads the settings from the Main Activity and set's up any views with changes such as font. 
	 * 
	 * @param void
	 * @return void
	 */
	@Override
	public void loadSettings() {
		// Set up temporary text view and set the font size aswell as the back button..
		TextView tmpTv = (TextView) this.findViewById(R.id.about_text);

		tmpTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, PresentationList.sFontSizePx);
		this.mBackButton.setTextSize(TypedValue.COMPLEX_UNIT_PX, PresentationList.sFontSizePx);
		
		tmpTv = null;
	}
	
	/**
	 * Runs when an onClick listener is triggered for the back button.
	 * 
	 * @param v View ID of the button pressed.
	 * @return void
	 */
    @Override
	public void onClick(View v) {
		// If the view is a mBtnPresentation...
		if(v == this.mBackButton) {
			this.finish();
		}
	}
		
}